<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/help.css" rel="stylesheet" type="text/css"/>
    <link href="__STATIC__/datetimepickerV3/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
</block>

<block name="body">
    <div class="col-md-12">
        <include file="Public/user_info"/>
        <include file="Public/_top_menu"/>
    </div>

    <div class="col-md-12 ask_for_help">
      <div class="bgwhite" style="min-height: 1000px;padding-bottom: 50px;margin-top: 0">
          <div class="help_h" style="">
              <h2 class="pull-left" style="width: 120px;">发布帮忙</h2>
          </div>


          <form class="form-horizontal ajax-form" role="form" action="{:U('help/index/ask')}" method="post" id="edit-article-form">
              <input type="hidden" name="help_id" value="{$help.id}"/>

              <div class="row">
                  <!-- 帖子分类 -->
                  <div class="col-sm-12 has-feedback" style="padding: 30px">
                      <div class="form-group ">
                          <label for="inputTitle" class="col-sm-1 control-label">标题<span class="text_must">*</span></label>
                          <div class="col-sm-5">
                              <input type="text" name="title" class="form-control form_check" check-type="Text" check-length="4,20" id="inputTitle" value="{$help.title}" >
                          </div> <span class="col-sm-5 tip" style="">一句话简述，不超过20字（不能带有任何联系方式）</span>
                      </div>


                      <div class="form-group">
                          <label  class="col-sm-1 control-label">地区<span class="text_must">*</span></label>
                          <div class="col-sm-8 area">
                              {:hook('J_China_City',array('province'=>$help['province'],'city'=>$help['city'],'district'=>$help['district']))}
                          </div>
                      </div>

                      <div class="form-group">
                          <label  class="col-sm-1 control-label">时间<span class="text_must">*</span></label>
                          <div class="col-sm-6 area">
                              <div style="width: 45%;display: inline-block" >
                              <input type="text" name="s_time" class="form-control time form_check" check-type="DateAndTime" <if condition="$help['s_time'] neq 0">value="{:date('Y-m-d H:i:s',$help['s_time'])}"</if>  >
                          </div>
                         -
                              <div style="width: 45%;display: inline-block" >

                              <input type="text" name="e_time" class="form-control time form_check" check-type="DateAndTime"  <if condition="$help['e_time'] neq 0"> value="{:date('Y-m-d H:i:s',$help['e_time'])}" </if> >

                          </div>
                          </div>
                          <span class="col-sm-5 tip" >开始时间和结束时间</span>
                      </div>

                      <div class="form-group">
                          <label  class="col-sm-1 control-label">类别<span class="text_must">*</span></label>
                          <div class="col-sm-10 help_type">
                              <volist name="help_type" id="htype">
                                  <label for="id_type_{$htype.id}" style="font-weight: normal">
                                      <input id="id_type_{$htype.id}" name="type" onclick="change_show({$htype['id']});" value="{$htype.id}" type="radio" <if condition="$i eq 1">checked</if> <if condition="$help['type'] eq $htype['id']">checked</if> >
                                        {$htype.title}</label>
                              </volist>

                          </div>

                      </div>

                      <div class="form-group all_show part_show">
                          <label for="inputDescription" class="col-sm-1 control-label">性别<span class="text_must">*</span></label>
                          <div class="col-sm-10 help_sex">
                              <label for="help_sex_0" style="font-weight: normal">
                                  <input id="help_sex_0" name="sex" value="0" type="radio"  <if condition="$help['sex'] eq 0">checked</if>>
                                  女</label>
                              <label for="help_sex_1" style="font-weight: normal">
                                  <input id="help_sex_1" name="sex" value="1" type="radio"  <if condition="$help['sex'] eq 1">checked</if>>
                                  男
                              </label>
                              <label for="help_sex_2" style="font-weight: normal">
                                  <input id="help_sex_2" name="sex" value="2" type="radio"  <if condition="$help['sex'] eq 2">checked</if>>
                                  不限
                              </label>
                          </div>
                      </div>

                      <div class="form-group all_show part_show">
                          <label for="inputTitle" class="col-sm-1 control-label">年龄<span class="text_must">*</span></label>
                          <div class="col-sm-5">
                              <div style="width: 30%;display: inline-block">
                                  <input type="text" name="s_age" class="form-control form_check" check-type="Num" can-empty="1" check-value="3,100"  value="{$help['s_age']}" >
                              </div>

                              -
                              <div style="width: 30%;display: inline-block">
                              <input type="text" name="e_age" class="form-control form_check" check-type="Num" can-empty="1" check-value="3,100" value="{$help['e_age']}" >
                                  </div>
                          </div>
                      </div>

                      <div class="form-group all_show">
                          <label for="inputTitle" class="col-sm-1 control-label">身高<span class="text_must">*</span></label>
                          <div class="col-sm-5">
                              <div style="width: 30%;display: inline-block">
                              <input type="text" name="s_height" class="form-control form_check" check-type="Num" can-empty="1" check-value="50,250" value="{$help['s_height']}" >
                              </div>
                              -
                                  <div style="width: 30%;display: inline-block">
                              <input type="text" name="e_height" class="form-control form_check" check-type="Num" can-empty="1" check-value="50,250" value="{$help['e_height']}">
                                  </div>
                          </div>
                      </div>

                      <div class="form-group all_show part_show">
                          <label for="inputTitle" class="col-sm-1 control-label">人数<span class="text_must">*</span></label>
                          <div class="col-sm-3">
                              <div style="width: 100%;display: inline-block">
                                  <input type="text" name="number" class="form-control form_check" check-type="Num" can-empty="1" check-value="1,*"  value="{$help['number']}" >
                              </div>
                          </div><span class="col-sm-5 tip" style="">人数至少为1</span>
                      </div>


                      <div class="form-group">
                          <label for="explain" class="col-sm-1 control-label">介绍<span class="text_must">*</span></label>

                          <div class="col-sm-10">

                              <php>$config='toolbar:[\'bold forecolor justifyleft justifycenter justifyright | image video link \']';
                              </php>
                              {:W('UeditorMini/editor',array('myeditor_edit','description',$help['description'],'95%','300px',$config))}

                              <div class="" style="font-size: 13px;">
                              <p style="color: #a0a0a0">
                                  描述里面最好写一些你需要帮助的具体细节，放一些你自己的照片或视频这样大家会更愿意帮忙，也可以放一些图片或视频的样例供参考。
                              </p>
                              <p style="color: #ff0000">
                                  注明：描述中不能带有电话、QQ、微信等联络方式，也不能带有色情或违法的内容，否则将不能通过审核！还会被打屁屁的哟！！
                              </p>
                          </div>

                          </div>
                    </div>

                      <div class="form-group">
                          <label class="col-sm-1 control-label">封面<span class="text_must">*</span></label>
                          <div  class="col-sm-10">
                              <a class="upload_cover btn btn-primary button_change" href="{:U('help/index/_uploadcover_ask')}">上传封面</a>
                              <input type="hidden" name="cover_id" value="{$help.cover_id}">
                              <div class="upload-img-box" style="margin-top: 10px;width: 250px;height: 250px;overflow: hidden; ">
                                  <if condition="$help['cover_id']">
                                      <div class="upload-pre-item"><img src="{$help.cover_id|get_cover='path'}"/></div>
                                  </if>
                              </div>
                          </div>
                      </div>


                  </div>
              </div>
              <p class="" style="margin: 0 auto;width: 101px;">
                  <button type="submit" class="btn btn-large btn-primary button_change" id="submit-button">
                            <span id="submit-content">
                                <if condition="$isEdit">
                                    修改
                                    <else/>
                                    完成发布
                                </if>
                            </span>
                  </button>
                  <input type="hidden" id="isEdit" value="{$isEdit}">
              </p>
          </form>
      </div>
    </div>
    <script>
        $(function () {
            bindUploadCover();
            var type_id="{$help['type']}";
            if(type_id>0){
                change_show(type_id);
            }
        });
        function change_show(type_id){
            if(type_id>0&&type_id<=4){
                $('.all_show').show();
            }else if(type_id<=7){
                $('.all_show').hide();
                $('.part_show').show();
            }else{
                $('.all_show').hide();
            }
        }
        function bindUploadCover() {
            $('.upload_cover').magnificPopup({
                type: 'ajax',
                overflowY: 'scroll',
                modal: true,
                callbacks: {
                }
            });
        }
    </script>
    <script type="text/javascript" src="__PUBLIC__/Core/js/form_check.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepickerV3/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepickerV3/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script>
        var changePosition;
        if(document.body.offsetWidth>992){
            changePosition=83;
        }else if(document.body.offsetWidth>768){
            changePosition=220;
        }else{
            changePosition=0;
        }

        $('.time').datetimepicker({
            language:'zh-CN',
            weekStart:1,
            todayBtn:1,
            autoclose:1,
            todayHighlight:1,
            startView:2,
            keyboardNavigation: 1,
            changePosition: changePosition,
            minView:0,
            top: 83,
            forceParse:0,
            format: 'yyyy-mm-dd hh:ii:ss'
        });
    </script>
</block>

